<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>v-model结合checkbox类型</title>
  <style>
    #app {
      margin-top: 50px;
      text-align: center;
    }
  </style>
</head>

<body>

  <div id="app">
    <!-- 1. checkbox单选 -->
    <label for="agree">
      <input type="checkbox" id="agree" v-model="isAgree"> 同意协议
    </label>
    <h3>您的选择是: {{ isAgree ? '同意' : '不同意' }}</h3>
    <button :disabled="!isAgree">下一步</button>
    <hr>

    <!-- 2. checkbox多选 -->
    <input type="checkbox" value="篮球" v-model="hobbies"> 篮球
    <input type="checkbox" value="足球" v-model="hobbies"> 足球
    <input type="checkbox" value="棒球" v-model="hobbies"> 棒球
    <input type="checkbox" value="羽毛球" v-model="hobbies"> 羽毛球

    <h3>您的选择是: {{ hobbies }}</h3>
  </div>

  <script src="../../js/vue.js"></script>
  <script>
    const app = new Vue({
      el: '#app',
      data: {
        isAgree: false,
        hobbies: []
      }
    })
  </script>
</body>

</html>